package krillr;
import krillr.Util.*;
import krillr.Modules.*;
import robocode.*;
import java.awt.Color;
import java.util.*;
import java.awt.geom.*;

public final class TheTardis extends KrillBot
{    
    public final void run() {
        /* Let the games begin! Assign playing to true to allow the event loop
         * and create our module list */
        fieldTracker = new BattlefieldTracker(this);
        playing = true;
        moduleList.add(new StandardGun(this));
        //moduleList.add(new DookiSailer(this));
        
        setAdjustGunForRobotTurn(true);
        setAdjustRadarForGunTurn(true);
        setAdjustRadarForRobotTurn(true);
        
        /* Lets make ourselves shexy */
        setColors(new Color(60,70,50),new Color(120,140,100),new Color(180,210,150));
        
        while(playing) {
            setTurnRadarLeftRadians(300);
            fieldTracker.run();
            /* Let the modules do their jobs */
            Iterator it = moduleList.iterator();
            while(it.hasNext()) {
                Module m = (Module)it.next();
                m.run();
            }
            
            if (!_scannedOnce) {
                setTurnRadarRight(90);
            } else {
                setTurnRadarRight(_trackAmount - _trackBackAmount);
                _trackBackAmount = 0;
            }
            
            execute();
            shapeList.add(new DebugShape(new Ellipse2D.Double(getX()-36,getY()-36,72,72), new Color(100,150,200)));
        }
    }
}
